<template>
    <el-container >
        <el-aside width="200px">

            <Menu></Menu>
        </el-aside>
        <el-container class="right-board">
            <el-header >
                <TopHeader></TopHeader>
            </el-header>

            <el-main style="margin-bottom:56px">
                <el-breadcrumb :separator-icon="ArrowRight">
                    <el-breadcrumb-item :to="{ path: '/' }">{{route.name}}</el-breadcrumb-item>
                </el-breadcrumb>
                <!-- <div style="height:20px;flex:none"></div> -->
                <el-divider style="border-color: #b88230;margin: 12px 0 ;" />
                <div class="content">
                    <router-view></router-view>
                </div>

            </el-main>
            <el-footer>
                <!-- Footer -->
            </el-footer>
        </el-container>
    </el-container>
</template>

<script lang="ts" setup>
import { ref, provide } from 'vue';
import checkLogin from '../assets/ts/common'
import { useRouter,useRoute } from 'vue-router'
import { ArrowRight } from '@element-plus/icons-vue'
import Menu from '../components/Layout/Menu.vue';
import TopHeader from '../components/Layout/TopHeader.vue';

const route = useRoute();
const router = useRouter();
const user_info = ref<any>({
    user_id:'',
    user_name:'',
    uniacid:'',  //店铺id
    uniacname:'',//店铺名称
});
provide('user_info', user_info )
// todo 检测登录状态， 已登录直接跳转到 主页
checkLogin( (res:any) => {
    user_info.value = res;
    if( res.code==1 ){
        router.push({path:'/login'});
    }else if( res.code==10 ){
        router.push({path:'/store'});
    }
});

</script>